﻿using System;
using System.Collections.Generic;
using AwesomeLogikFacade;
using AwesomeSSPLSLogik;


namespace AwesomeWcf
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
    public class Awesome : IAwesome
    {

        #region Player
        public Boolean CheckPlayer(string playerName)
        {
            return LogikFacade.CheckPlayer(playerName);
        }

        public LPlayer LoginPlayer(string login, string password)
        {
            return LogikFacade.loginPlayer(login, password);
        }
        public bool SetNamePlayer(string playerName)
        {
            return LogikFacade.SetAndControlPlayerName(playerName);
        }
        #endregion

        #region GameSpecifik
        #endregion

        #region Common
        #endregion

        public Boolean DeleteGameSession(int sessionId)
        {
            return LogikFacade.DeleteGameSession(sessionId);
            //throw new NotImplementedException();
        }

        public Boolean DeletePlayerSession(int playerId, int sessionId)
        {
            return LogikFacade.DeletePlayerSession(playerId, sessionId);
        }

        public Boolean CreateNonrandomGamesession(int playerId, int gameId, int rounds)
        {
            return LogikFacade.CreateNonrandomGamesession(playerId, gameId, rounds);
        }

        public Boolean UpdateGameRounds(int id, int rounds)
        {
            return LogikFacade.UpdateGameRounds(id, rounds);
        }

        public List<LGameSession> GetGameSession(string playerName)
        {
            return LogikFacade.GetGameSessionList(playerName);
        }

        public List<LGame> GetGame()
        {
            return LogikFacade.GetAllGames();
        }

        public List<LPlayer> GetAllPlayer()
        {
            return LogikFacade.GetAllPlayers();
        }


        public Boolean AddPlayerSession(int playerId, int sessionId)
        {
            return LogikFacade.AddPlayerSession(playerId, sessionId);
        }

        //public List<GameSession> GetAllActiveGameSessions()
        //{
            
        //}

        public List<LGameSession> GetAllActiveGameSessions()
        {
            return LogikFacade.GetAllActiveGameSessions();
        }

        public bool MakePlayerChoice(int gameSessionId, int playerId, int playerChoiceId)
        {
            return LogikFacade.MakePlayerChoice(gameSessionId, playerId, playerChoiceId);
        }

        /// <summary>
        /// Gets the current players active game sessions
        /// </summary>
        /// <param name="playerId">Players id</param>
        /// <returns>List of LGameSessions</returns>
        public List<LGameSession> GetPlayersGameSessions(int playerId)
        {
            return LogikFacade.GetPlayersGameSessions(playerId);
        }

        public List<LGameSession> GetAllJoinableGameSessions(int gameId)
        {
            return LogikFacade.GetAllJoinableGameSessions(gameId);
        }

    }
}
